Open
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces new CQRS functionality by separating command and query responsibilities for room operations, and implements additional endpoints for room leave and delete actions.
- Implements joinRoom, leaveRoom, and deleteRoom methods in RoomService.
- Introduces a new RoomQueryService to handle read operations.
- Updates RoomController and InvitationController to use the new service methods.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/backend/main-server/main/src/main/java/com/kickzo/main/service/RoomService.java | Refactors room join flow and adds leaveRoom and deleteRoom functionalities. |
| src/backend/main-server/main/src/main/java/com/kickzo/main/service/RoomQueryService.java | New service for handling read operations and room information retrieval. |
| src/backend/main-server/main/src/main/java/com/kickzo/main/repository/UserOutRedisRepository.java | Adds method to remove room entries from Redis. |
| src/backend/main-server/main/src/main/java/com/kickzo/main/repository/RoomUserRepository.java | Adds deleteByRoomId method for removing all room users on room deletion. |
| src/backend/main-server/main/src/main/java/com/kickzo/main/controller/RoomController.java | Updates endpoints to reflect new command/query separation and adds endpoints for leaving and deleting a room. |
| src/backend/main-server/main/src/main/java/com/kickzo/main/controller/InvitationController.java | Adjusts dependency to use RoomQueryService for invitation acceptance flow. |
Comments suppressed due to low confidence (1)
src/backend/main-server/main/src/main/java/com/kickzo/main/service/RoomService.java:90
- The call to findRoleByUserIdAndRoomId may return null; consider changing the variable type to Integer and adding a null check before comparing against 0.
int role = roomUserRepository.findRoleByUserIdAndRoomId(roomId, userId);
42inshin
reviewed
Mar 30, 2025
Member
42inshin
left a comment
There was a problem hiding this comment.
java 코드도 한번씩 PR 보려고 해요~! 화이팅입니다
Comment on lines
90
to
93
| int role = roomUserRepository.findRoleByUserIdAndRoomId(roomId, userId); | ||
| if (role != 0){ | ||
| throw new CustomException(CustomErrorCode.INVALID_ACCESS_ROLE); | ||
| } |
Member
There was a problem hiding this comment.
role을 enum을 만들어서 관리하는건 어떨까요? 나중에 볼때 0번이 뭔지 기억 안날수도 있을 것 같아요
ai 추천으로는 아래 방식을 알려주네요 ㅎㅎ
// 삭제 권한 확인 (ADMIN = 0)
Integer role = roomUserRepository.findRoleByUserIdAndRoomId(roomId, userId);
if (role == null || !Objects.equals(role, RoomRole.ADMIN.getValue())) {
throw new CustomException(CustomErrorCode.INVALID_ACCESS_ROLE);
}public enum RoomRole {
ADMIN(0),
MEMBER(1);
private final int value;
RoomRole(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
Collaborator
Author
There was a problem hiding this comment.
수정 완료 하였습니다! 감사합니다~
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
해당 사항 (중복 선택)
설명
RoomCommandService (write)
RoomQueryService (read) 의 경우
@Transactional(readOnly = true)적용🔗 관련 이슈
해결한 이슈: closed #260
📝 작업 내용
1. CQRS 패턴 적용
K6 성능 테스트 결과 (10명, 30명, 50명 들어있는 방에서 데이터 조회(GET)및 변경(POST) 성능 테스트)
2. 방 나가기 / 방 삭제 기능 추가
*creator가 방 나가기를 했을 경우 새로운 creator는 누구에게로 주어야하는가의 문제가 새롭게 생김